package com.xjtu.weixin.controller.template;

import com.xjtu.weixin.model.entity.MpTemplate;
import com.xjtu.weixin.service.MpTemplateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * ${DESCRIPTION}
 *
 * @author 杨凯
 * @create 2018-09-05 14:42
 **/
@Controller
@Slf4j
@RequestMapping("/template")
public class TemplateController {

	@Autowired
	private MpTemplateService templateService;

	/**
	 * 模板列表
	 * @param model
	 * @return
	 */
	@GetMapping
	public String templateList(Model model){
		final List<MpTemplate> templateList = templateService.getTemplateList();
		model.addAttribute("templateList",templateList);
		return "admin/template/template-list";
	}
}
